doctype html
html(lang='en')
  head
    meta(charset='utf-8')
    meta(http-equiv='X-UA-Compatible', content='IE=edge')
    meta(name='viewport', content='width=device-width, initial-scale=1')
    title 测试
    // Bootstrap
    link(rel='stylesheet', href='/plugins/bootstrap/css/bootstrap.min.css')
    // 可选的Bootstrap主题文件（一般不用引入）
    link(rel='stylesheet', href='/css/style.css')
    link(rel='stylesheet', href='/css/style-metronic.css')
    link(rel='stylesheet', href='/css/style-responsive.css')
    link(rel='stylesheet', href='/css/themes/default.css')
    link(rel='stylesheet', href='/plugins/select2/select2_metro.css')
    link(rel='stylesheet', href='/plugins/data-tables/DT_bootstrap.css')
    link(rel='stylesheet', href='/css/login.css')
    link(rel='stylesheet', href='/plugins/font-awesome/css/font-awesome.min.css')
    // HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries
    // WARNING: Respond.js doesn't work if you view the page via file://
    |<!--[if lt IE 9]>
    |  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    |  <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    |<![endif]-->
    body.login
      div.logo
        image(src="/img/logo.png")
      div.content
        form#form.login-form
          h3.form-title Login to your account
          div.alert.alert-danger.hide
            button.close("data-close"="alert")
            span 用户名密码错误
          div.form-group
            div.input-icon.left
              i.fa.fa-user
              input.form-control(placeholder='用户名',name='username')
          div.form-group
            div.input-icon.left
              i.fa.fa-lock
              input.form-control(type='password',placeholder='密码',name='password')
          div.form-actions
            button.btn.green.pull-right(type="submit") 登陆
script(src="/plugins/jquery-1.10.2.min.js")
script(src="/plugins/bootstrap/js/bootstrap.min.js")
script(src="/plugins/jquery.cookie.min.js")
script(src="/scripts/bootstrap-paginator.js")
script(src="/plugins/select2/select2.min.js")
script(src="/plugins/data-tables/jquery.dataTables.js")
script(src='/plugins/data-tables/DT_bootstrap.js')
script(src='/plugins/jquery-file-upload/js/vendor/jquery.ui.widget.js')
script(src='/plugins/jquery-file-upload/js/jquery.fileupload.js')
script(type='text/javascript').
  $('#form').submit(function(){
                 $.ajax({
                    url: "/admin/login",   // 提交的页面
                    data: $('#form').serialize(), // 从表单中获取数据
                    type: "POST",                   // 设置请求类型为"POST"，默认为"GET"
                    error: function(request) {      // 设置表单提交出错
                        $(".alert").removeClass('hide');
                        return false;
                    },
                    success: function(data) {
                      if(data.code)
                        window.location.href="/admin/type";
                      else
                        $(".alert").removeClass('hide').addClass('show');
                        }
                    });
                return false;
            });